package com.orion.enumeration;

import com.orion.entity.Result;

/**
 * @author Administrator
 * @date 2021/10/9
 */
public enum Oauth2ExceptionCodeEnum {

    /**
     * oauth2 异常枚举
     */
    INVALID_REQUEST(9000,"invalid request"),

    INVALID_CLIENT(9001,"invalid client"),

    INVALID_GRANT(9002, "invalid grant"),

    UNAUTHORIZED_CLIENT (9003, "unauthorized client"),

    UNSUPPORTED_GRANT_TYPE (9004, "unsupported grant type"),

    INVALID_SCOPE (9005, "invalid scope"),

    INSUFFICIENT_SCOPE(9006, "insufficient scope"),

    INVALID_TOKEN (9007, "invalid token"),

    REDIRECT_URI_MISMATCH (9008,"redirect uri mismatch"),

    UNSUPPORTED_RESPONSE_TYPE (9009,"unsupported response type"),

    ACCESS_DENIED(9010, "access denied"),

    AUTHORIZE_UNSUPPORTED_REQUEST_METHOD(9011,"authorize unsupported request method"),

    INVALID_CLIENT_SECRET(9012,"invalid client secret"),

    UNAUTHORIZED (9023, "unauthorized");


    private Integer code;

    private String msg;

    Oauth2ExceptionCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Result toResult(){
        return  new Result( getMsg(),getCode());
    }
}

